/*******************************************************************************

 * Copyright (c) 2009 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Ali Ok (www.aliok.info) - initial API and implementation
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.internal.search;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;

/**
 * Used for calculating the number of members of some resource.
 * This class is not intended to be used anywhere except this plugin.
 * 
 * @author Ali Ok
 */
final public class ResourceCounter implements IResourceVisitor {
	private int resourceCount = 0;

	public boolean visit(IResource resource) throws CoreException {
		resourceCount++;
		if (resource.getType() == IResource.FILE) {
			return false;
		}
		return true;
	}

	public int getResourceCount() {
		return resourceCount;
	}
}